<template>
	<view class="content">
		
		<view>
			年龄:{{age}}
			性别：{{sex}}
			手机：{{phone}}
			出生日期:{{setDate}}
		</view>
		<button type="default" @click="remnumb(1)">加1</button>
		<button type="default" @click="remnumb(-1)">减1</button>
	</view>
</template>
<script>
	import {ref,reactive,computed,toRefs} from 'vue'
	export default{
		setup(){
			// let data={}
			let data=reactive({
				age:18,
				sex:'女',
				phone:136,
				setDate1:computed({
					get:()=>{
						return data.age-=1
					},
					set:(val)=>{
						return data.age=2022-val
					}
				})
			});
			function remnumb(val){
				data.setDate1=data.setDate1+val
				
			};
			return {...toRefs(data),remnumb}
		}
	}
	
	
	
</script>
<!-- <script setup>
	import {ref,reactive,computed,toRefs} from 'vue'
	let un1=ref(45);
	let sb=ref("哈哈哈");
	let sb1=reactive({a:"哈哈",b:"嘿嘿"})
	function addnumb(){
		un1.value++;
	}
	function remnumb(){
		
	}
	
	
</script> -->

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
